package com.example.eliliya.xmldesign;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

/**
 * Created by EliLiya on 2018/4/20.
 */

public class SecondActivity extends Activity{
    private Intent intent;
    private Bundle bundle;
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second);
        Bundle bund=this.getIntent().getExtras();
        String ans=bund.getString("ans");
        String setText="";
        if (ans.equals("in")){
            setText="正确";
        }
        else{
            setText="错误";
        }
        TextView tv1=(TextView)findViewById(R.id.text1);
        tv1.setText("你选择的答案是："+setText);
        Button btn3_back=(Button)findViewById(R.id.button_back);
        btn3_back.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v){
                SecondActivity.this.setResult(RESULT_OK,intent);
                SecondActivity.this.finish();
            }
        });
    }
}
